-module(p36).
-compile(export_all).

main(Bound) ->
    [X || X <- lists:seq(1, Bound),
          is_palindrom_bin_dec(X)].

to_dec(BinAsList) -> 
    {ok, [Dec], []} = io_lib:fread("~2u", BinAsList),
    erlang:integer_to_list(Dec).

to_bin(Dec) ->
    [BinAsList] = io_lib:format("~.2B", [Dec]),
    BinAsList. 

is_palindrom(NumAsList) -> 
    NumAsList =:= lists:reverse(NumAsList).

is_palindrom_bin_dec(Num) ->
    NumAsList = erlang:integer_to_list(Num),
    is_palindrom(NumAsList) andalso is_palindrom(to_bin(Num)).
